package com.carlos.company.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.sql.ResultSet;

/**
 * @author 李健成
 * @date 2021/9/27
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVO<T> implements Serializable {

    private static final long serialVersionUID = 8799479549615979833L;

    private String code;
    private String message;
    private T data;

    public ResultVO<T> success() {
        this.code = "1";
        this.message = "success";
        return this;
    }

    public ResultVO<T> fail() {
        this.code = "2";
        this.message = "fail";
        return this;
    }

    public ResultVO<T> fail(String message) {
        this.code = "2";
        this.message = message;
        return this;
    }

    public ResultVO<T> data(T data) {
        this.data = data;
        return this;
    }

}
